package cn.boodqian.airreport;

import cn.boodqian.util.Log;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class ServerMessageActivity extends Activity {
	private TextView mServerMessageTitle;
	private TextView mServerMessageBody;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.servermessage);
		
		//mServerMessageTitle = (TextView)findViewById(R.id.servermessage_title);
		//mServerMessageBody = (TextView)findViewById(R.id.servermessage_body);
	}
	@Override
	protected void onNewIntent(Intent intent) {
		super.onNewIntent(intent);
		setIntent(intent);
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		
		Intent intent = getIntent();
		String title = intent.getStringExtra("title");
		String message = intent.getStringExtra("message");
		if(title == null || message == null) return;
		
		new AlertDialog.Builder(this).setTitle(title)
		    .setMessage(message)
		    .setPositiveButton(getString(R.string.iknow), new OnClickListener() {

				@Override
				public void onClick(DialogInterface dialog, int which) {
					finish(); // End the activity
				}
		    }).show();
		
		//Not good looking... may be used in future
		//mServerMessageTitle.setText(title);
		//mServerMessageBody.setText(message);
	}
}
